package lab01;

/**
 * Created by Administrator on 2017/9/24.
 */
public class Test05 {
    public static void main(String[] args) {
        int sum = 0;
        //for循环求和
        for (int i = 0;i <= 100;i++){
            sum+=i;
        }
        System.out.println("for:"+sum);

        sum = 0;
        //while循环求和
        int j = 1;
        while (j <= 100){
            sum+=j;
            j++;
        }
        System.out.println("while:"+sum);

        sum = 0;
        //do-while循环求和
        int k = 1;
        do{
            sum+=k;
            k++;
        }while(k <= 100);
        System.out.println("do-while:"+sum);
    }
}
